# 装饰器的学习
import time


def timer(func):
    def wrapper(seconds):
        start_time = time.time()
        func(seconds)
        stop_time = time.time()
        print('运行时间是%s秒' % (stop_time - start_time))

    return wrapper


@timer
def i_can_sleep(seconds):
    time.sleep(seconds)


i_can_sleep(3)


def new_tips(argv):
    def tips(func):
        def computer(a, b):
            print('开始%s %s' % (argv, func.__name__))
            func(a, b)
            print('结束时间')

        return computer

    return tips


@new_tips('add_module')
def add(a: int, b: int) ->None:
    print( a + b)


@new_tips('sub_module')
def sub(a: int, b: int) -> None:
    print(a - b)
